<% 
	reports_list, role  = reports
	title = role.description_for_reports unless current_user.roles.size == 1
	is_xb = role.is_xb
%>

<table class="xbtable" cellspacing="0" cellpadding="0">
<% if title then %> <span class="title_one"><%= title %></span> <% end %>
	<tr>
        <th class="col1"><%= _('Title') %></th>
        <th class="col2"><%= _('Proposed By') %></th>
        <th class="col3"><%= _('Requested On') %></th>
        <th class="col4"><%= _('Due Date') %></th>
		<th class="col5"><%= _('Completed') %></th>
		<% if is_xb then %>
		<th class="col6"><%= _('Matching XB Status') %></th>
		<% end %>
    	<th class="col7"> </th>
		<% if download_col then %>
		<th class="col8"> </th>
		<% end %>
	</tr>
	<% (reports_list.reject {|n| nil}).each { |report| %>
	<tr>
		<% request = report.report_request %>
		<td class="col1">
			<% if report.is_submitted %>
				<%= link_to request.title_and_period, :action => 'view', :id => report.id %>
			<% else%>
				<%= request.title_and_period %>
			<% end %>
		</td>
		<td class="col2"><%=report.requestor.name rescue nil %></td>
		<td class="col3"><%=request.created_at.strftime("%x") rescue nil %></td>
		<td class="col4"><%=request.due_date.strftime("%x") rescue nil %></td>
		<td class="col5">
			<%if not report.completed.nil?
				value = report.completed*100
				imgname = case value.to_i 
					when 0..20 then "perc20.gif"
					when 21..40 then "perc40.gif"
					when 41.. 60 then "perc60.gif"
					when 61..80 then "perc80.gif"
					when 81..100 then  "perc100.gif"
				end%>
			<%= image_tag imgname rescue nil %>
			<%= percentage report.completed rescue nil %>
			<%end%>
		</td>
		<% if is_xb then %>
		<td class="col6"><%=report.matching_xbs_completed rescue nil%>
		</td>
		<% end %>
		<td class="col7">
		<% if report.is_submitted then %>
			<%= link_to(image_tag('b_view.gif'), :action => 'view', :id => report.id)%>
		<% end %>
		<%= link_to(image_tag('b_edit.gif'), :action => 'edit', :id => report.id)%>
		</td>
		<% if report.is_submitted && download_col then %>
		<td class="col8">
			<!-- <%= link_to image_tag('ic_ppt.gif'), '#'%> -->
			<%= link_to image_tag('ic_pdf.gif'), :controller=>"pdf_generator", :format=>'pdf', :action=>role.coordinated_type, :id => report.id %> 
		</td>
		<% end %>			
	</tr>
	<% } %>
</table>